/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.restaurant.domain;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author root
 */
@Entity
@Table(name = "tableorder")
@XmlRootElement(name = "tableorder")
@NamedQueries({
    @NamedQuery(name = "Tableorder.findAll", query = "SELECT t FROM Tableorder t"),
    @NamedQuery(name = "Tableorder.findByTableorderID", query = "SELECT t FROM Tableorder t WHERE t.tableorderID = :tableorderID"),
    @NamedQuery(name = "Tableorder.findByStarttime", query = "SELECT t FROM Tableorder t WHERE t.starttime = :starttime"),
    @NamedQuery(name = "Tableorder.findByEndtime", query = "SELECT t FROM Tableorder t WHERE t.endtime = :endtime"),
    @NamedQuery(name = "Tableorder.findByIsended", query = "SELECT t FROM Tableorder t WHERE t.isended = :isended"),
    @NamedQuery(name = "Tableorder.findByIsdeleted", query = "SELECT t FROM Tableorder t WHERE t.isdeleted = :isdeleted")})
public class Tableorder implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "TableorderID")
    private Long tableorderID;
    @Column(name = "starttime")
    @Temporal(TemporalType.TIMESTAMP)
    private Date starttime;
    @Column(name = "endtime")
    @Temporal(TemporalType.TIMESTAMP)
    private Date endtime;
    @Basic(optional = false)
    @Column(name = "isended")
    private boolean isended;
    @Basic(optional = false)
    @Column(name = "isdeleted")
    private boolean isdeleted;
    @JoinColumn(name = "person_PersonID", referencedColumnName = "PersonID")
    @ManyToOne
    private Person person;
    @JoinColumn(name = "table_TableID", referencedColumnName = "TableID")
    @ManyToOne(optional = false)
    private Tables tables;
    @JoinColumn(name = "employee_EmployeeID", referencedColumnName = "EmployeeID")
    @ManyToOne(optional = false)
    private Employee employee;

    public Tableorder() {
    }

    public Tableorder(Long tableorderID) {
        this.tableorderID = tableorderID;
    }

    public Tableorder(Long tableorderID, boolean isended, boolean isdeleted) {
        this.tableorderID = tableorderID;
        this.isended = isended;
        this.isdeleted = isdeleted;
    }

    public Long getTableorderID() {
        return tableorderID;
    }

    public void setTableorderID(Long tableorderID) {
        this.tableorderID = tableorderID;
    }

    public Date getStarttime() {
        return starttime;
    }

    public void setStarttime(Date starttime) {
        this.starttime = starttime;
    }

    public Date getEndtime() {
        return endtime;
    }

    public void setEndtime(Date endtime) {
        this.endtime = endtime;
    }

    public boolean getIsended() {
        return isended;
    }

    public void setIsended(boolean isended) {
        this.isended = isended;
    }

    public boolean getIsdeleted() {
        return isdeleted;
    }

    public void setIsdeleted(boolean isdeleted) {
        this.isdeleted = isdeleted;
    }

    public Person getPerson() {
        return person;
    }

    public void setPerson(Person person) {
        this.person = person;
    }

    public Tables getTables() {
        return tables;
    }

    public void setTables(Tables tables) {
        this.tables = tables;
    }

    public Employee getEmployee() {
        return employee;
    }

    public void setEmployee(Employee employee) {
        this.employee = employee;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (tableorderID != null ? tableorderID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tableorder)) {
            return false;
        }
        Tableorder other = (Tableorder) object;
        if ((this.tableorderID == null && other.tableorderID != null) || (this.tableorderID != null && !this.tableorderID.equals(other.tableorderID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.restaurant.domain.Tableorder[tableorderID=" + tableorderID + "]";
    }

}
